cmake_minimum_required(VERSION 3.2)
project(test)
set(CMAKE_CXX_FLAGS "-std=c++14")
find_package(OpenCV 4.0)
MESSAGE(${OpenCV_VERSION})
list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules )
find_package(G2O REQUIRED)
# find_package(Pangolin REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Sophus REQUIRED)
find_package(fmt)

set(ALL_TARGET_LIBRARIES "")

include(cmake/DBoW3.cmake)
include(cmake/glog.cmake)

include_directories(
    ${EIGEN3_INCLUDE_DIR}
    ${DBoW3_INCLUDE_DIRS}
    ${G2O_INCLUDE_DIR}
    ${Pangolin_INCLUDE_DIRS}
    ${Sophus_INCLUDE_DIRS}
)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
add_library(ORBSLAM SHARED
src/ORBFeature.cpp
src/Frame.cpp
src/DataIO.cpp
src/Track.cpp
src/MultipleViewGeometry.cpp
src/SlamProcess.cpp
src/Matcher.cpp
src/Param.cpp
# src/KeyFrame.cpp
src/Map.cpp
src/MapPoint.cpp
src/MapAtlas.cpp
src/Optimizer.cpp
src/LocalMap.cpp
src/Converter.cpp
# src/Viewer.cpp
src/Debuger.cpp
src/KeyFrameDatabase.cpp
src/LoopClosing.cpp
src/Sim3Solver.cpp
src/Imu.cpp
include/ORBFeature.hpp
include/Frame.hpp
include/DataIO.hpp
include/Track.hpp
include/MultipleViewGeometry.hpp
include/SlamProcess.hpp
include/Matcher.hpp
include/Param.hpp
include/Imu.hpp
# include/KeyFrame.hpp
include/Map.hpp
include/MapPoint.hpp
include/MapAtlas.hpp
include/Optimizer.hpp
include/LocalMap.hpp
include/Typedef.hpp
include/Converter.hpp
# include/Viewer.hpp
include/Debuger.hpp
include/KeyFrameDatabase.hpp
include/LoopClosing.hpp
include/Sim3Solver.hpp
)


#SET(G2O_LIBS g2o_cli g2o_ext_freeglut_minimal g2o_simulator g2o_solver_slam2d_linear g2o_types_icp g2o_types_slam2d g2o_core g2o_interface g2o_solver_csparse g2o_solver_structure_only g2o_types_sba g2o_types_slam3d g2o_csparse_extension g2o_opengl_helper g2o_solver_dense g2o_stuff g2o_types_sclam2d g2o_parser g2o_solver_pcg g2o_types_data g2o_types_sim3 cxsparse )
SET(G2O_LIBS g2o_cli g2o_ext_freeglut_minimal g2o_simulator g2o_solver_slam2d_linear g2o_types_icp g2o_types_slam2d g2o_core g2o_interface g2o_solver_structure_only g2o_types_sba g2o_types_slam3d g2o_opengl_helper g2o_solver_dense g2o_stuff g2o_types_sclam2d g2o_parser g2o_solver_pcg g2o_types_data g2o_types_sim3 )
target_link_libraries(ORBSLAM
${OpenCV_LIBS}
${EIGEN3_LIBS}
${DBoW3_LIBS}
${G2O_STUFF_LIBRARY}
${G2O_CORE_LIBRARY} 
${G2O_TYPES_SBA} 
${G2O_SOLVER_DENSE} 
${G2O_SOLVER_EIGEN}
${G2O_LIBS}
${Pangolin_LIBRARIES}
${Sophus_LIBRARIES}
${ALL_TARGET_LIBRARIES}
fmt::fmt
)

add_executable(test src/test.cpp)
target_link_libraries(test
${OpenCV_LIBS}
ORBSLAM
)